// @APIVersion 1.0.0
// @Title 小二菜单API
// @Description 小二菜单API
// @Contact 896144801@qq.com

package routers

import (
	"github.com/astaxie/beego"
	"xiaoercaidan/baseApi/apis"
	"github.com/astaxie/beego/plugins/cors"
)

func init() {

	apiNs := beego.NewNamespace("/v1",


		beego.NSNamespace("/apis",

			beego.NSNamespace("/user",
				beego.NSInclude(
					&apis.UserApi{},
				),
			),


			beego.NSNamespace("/shop",
				beego.NSInclude(
					&apis.ShopApi{},
				),
			),
			beego.NSNamespace("/goods",
				beego.NSInclude(
					&apis.GoodsApi{},
				),
			),
			beego.NSNamespace("/file",
				beego.NSInclude(
					&apis.FileApi{},
				),
			),
			beego.NSNamespace("/tables",
				beego.NSInclude(
					&apis.TableApi{},
				),
			),
			beego.NSNamespace("/ring",
				beego.NSInclude(
					&apis.RingApi{},
				),
			),


		),
	)

	beego.AddNamespace(apiNs)

	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
		AllowAllOrigins:  true,
		AllowMethods:     []string{"*"},
		AllowHeaders:     []string{"Origin", "Authorization", "Access-Control-Allow-Origin"},
		ExposeHeaders:    []string{"Content-Length", "Access-Control-Allow-Origin"},
		AllowCredentials: true,
	}))

}
